<?php

namespace app\admin\model;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use support\Model;

/**
 * 文件模型
 * @property int $id
 * @property string $name 文件名
 * @property string $original_name 原始文件名
 * @property string $path 文件路径
 * @property string $url 文件URL
 * @property string $extension 文件扩展名
 * @property string $mime_type MIME类型
 * @property int $size 文件大小(字节)
 * @property string|null $unique_id 唯一标识
 * @property int $status 状态:0=禁用,1=启用
 * @property string $create_time 创建时间
 * @property string $update_time 更新时间
 */
class FileUpload extends Model
{
    /**
     * The table associated with the model.
     * @var string
     */
    protected $table = 'file_upload';
    /**
     * The primary key associated with the table.
     * @var string
     */
    protected $primaryKey = 'id';
    /**
     * Indicates if the model should be timestamped.
     * @var bool
     */
    public $timestamps = true;
    /**
     * The name of the "created at" column.
     * @var string|null
     */
    const CREATED_AT = 'create_time';
    /**
     * The name of the "updated at" column.
     * @var string|null
     */
    const UPDATED_AT = 'update_time';
    /**
     * The attributes that are mass assignable.
     * @var array
     */
    protected $fillable = [
        'name',
        'original_name',
        'path',
        'url',
        'extension',
        'mime_type',
        'size',
        'unique_id',
        'status',
    ];
    /**
     * The attributes that should be cast to native types.
     * @var array
     */
    protected $casts = [
        'size' => 'integer',
        'status' => 'integer',
        'create_time' => 'datetime:Y-m-d H:i:s',
        'update_time' => 'datetime:Y-m-d H:i:s',
    ];
}